
float distanceFromObject = 0;
float4 colorOfLight = float4(0,0,0,1);
sampler TextureSampler:register(s0);

float4 PixelShaderFunction(float2 Tex:TEXCOORD0) : COLOR0
{


	float4 Color = tex2D(TextureSampler,Tex);	
	float4 lighting = float4(distanceFromObject,distanceFromObject,distanceFromObject,Color.a);
	Color.r= Color.r-lighting.r;
	Color.g = Color.g-lighting.g;
	Color.b = Color.b-lighting.b;

	float4 lightColor = colorOfLight;
	lightColor = trunc(lightColor);
	if(!all(lightColor))
	{
		Color.r =0.5;
		return Color;
	}
	return Color;
}

technique hit
{
	pass Pass1
	{
		PixelShader = compile ps_2_0 PixelShaderFunction();
	}
}